]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dash: Do not destroy a dash label twice
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Mon, 17 Apr 2023 17:53:34 +0000 (19:53 +0200)
committerMarge Bot <marge-bot@gnome.org>
Mon, 17 Apr 2023 20:22:12 +0000 (20:22 +0000)
Dash labels are children of the main uiGroup and so could be destroyed
before their logical-owner DashItemContainer during shutdown.

This implies that we could destroy them twice. To avoid this, unset them
when destroyed.

This is mostly visible when using dash-to-dock, but it's still
technically possible with upstream code:

** Message: 19:57:49.847: Shutting down GNOME Shell

(gnome-shell:2788214): Gjs-CRITICAL **: 19:57:49.933: Object St.Label
 (0x55b33668eab0), has been already disposed — impossible to access it.
 This might be caused by the object having been destroyed from C code using
something such as destroy(), dispose(), or remove() vfuncs.
  == Stack trace for context 0x55b3345fd3d0 ==
  #0   7ffeabd810d0 b   /data/GNOME/gnome-shell/js/ui/dash.js:86
  #1   55b335b62f88 i   /data/GNOME/JHBUILD_HOME/.local/share/gnome-shell/extensions/dash-to-dock@micxgx.gmail.com/docking.js:487
  #2   7ffeabd838f0 b   self-hosted:1121
  #3   55b335b62ec8 i   /data/GNOME/gnome-shell/js/ui/layout.js:240

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2739>

js/ui/dash.js

index 212592bdfe67c54346707080c451c5e09aa68019..188308853f353e6c2a2e61c018204379766b29c1 100644 (file)
@@ -71,6 +71,7 @@ class DashItemContainer extends St.Widget {
         this.label = new St.Label({ style_class: 'dash-label' });
         this.label.hide();
         Main.layoutManager.addChrome(this.label);
+        this.label.connectObject('destroy', () => (this.label = null), this);
         this.label_actor = this.label;
 
         this.child = null;
@@ -82,7 +83,7 @@ class DashItemContainer extends St.Widget {
         this.connect('destroy', () => {
             if (this.child != null)
                 this.child.destroy();
-            this.label.destroy();
+            this.label?.destroy();
         });
     }